// 导入vue-router
import {createRouter, createWebHistory} from 'vue-router'

// 导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import UserList from '@/views/user/UserList.vue'
import EditPassword from '@/views/user/EditPassword.vue'
import DisplayUser from '@/views/user/DisplayUser.vue'
import Register from '@/views/register.vue'

import CustomerList from '@/views/customer/customerlist.vue'
import Businesslist from '@/views/business/businesslist.vue'

import WorkorderList from '@/views/workorder/workorder.vue'
import Rigionlist from '@/views/region/regionlist.vue'

// 定义路由关系
const routes = [
    {path: '/login', component: LoginVue},
    {
        path: '/', component: LayoutVue, redirect: '', 
        children: 
        [
            {path: '/user/userlist', name: "/user/userlist", component: UserList, meta: {
                title: "用户列表"
            }
            },
            {path: '/user/editpassword', name: "/user/editpassword", component: EditPassword, meta: {
                title: "修改密码"
            }
            },
            {path: '/user/displayuser', name: "/user/displayuser", component: DisplayUser, meta: {
                title: "员工恢复"
            }},
            {path: '/customer/customerlist', name: "/customer/customerlist", component: CustomerList, meta: {
                title: "客户列表"
            }
            },
            {path: '/business/businesslist', name: "/business/businesslistt", component: Businesslist, meta: {
                title: "业务列表"
            }
            },
            {path: '/workorder/workorder', name: "/workorder/workorder", component: WorkorderList, meta: {
                title: "工单列表"
            }
            },
            {path: '/region/regionlist', name: "/region/regionlist", component: Rigionlist, meta: {
                title: "区域列表"
            }
            },
        ]
    },
  { path: '/register', name: 'Register', component: Register, meta: { title: '注册新账号' } } // 添加注册页面的路由
]

// 创建路由器 
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

export default router